#############################
## BLIS/Swayable: Figure 6 ##
#############################

# File Description: 
# Uses data/packages from O_Data.R
# Replicates Figure 6 from Fabric of Repair report (2025)
# Date Last Updated: 2 May 2025

#############################

# Regression model stratified by race and party, Land Back support
land_back_polrace <- lm(Land.Back.Support ~ race*summarized_party*treatment + video_perception, data = df) 

# Regression model stratified by race and party, Reparations support
reparations_polrace <- lm(Reparations.Support ~ race*summarized_party*treatment + video_perception, data = df)

# Predictions by race and party, Land Back support
lb_pol <- ggpredict(land_back_polrace, terms = c("treatment", "race", "summarized_party")) %>%
  mutate(outcome = "Land Back")

# Predictions by race and party, Reparations support
r_pol <- ggpredict(reparations_polrace, terms = c("treatment", "race", "summarized_party")) %>%
  mutate(outcome = "Reparations")

# Merging predictions
full_preds_threeway <- rbind(lb_pol, r_pol)

# Plotting Figure 6
full_preds_threeway %>%
  ggplot(aes(x = x, y = predicted, fill = group)) + 
  geom_col(position = "dodge") +
  geom_errorbar(aes(ymin = conf.low, ymax = conf.high), position=position_dodge(.9), width=.2) +
  labs(x = "Video", y = "Average Support", fill = "Race", caption = "Note: Model includes a control for respondents' perceived production quality.") +
  facet_grid(vars(outcome),vars(facet)) +
  scale_fill_manual(values = c('Black' = '#4C230A', 'Indigenous' = '#F4C900')) + 
  theme_bw() +
  scale_y_continuous(limits = c(0, 10), breaks = c(0, 2.5, 5, 7.5, 10)) +
  labs(title = "Movement Support Across Political Ideologies")
